package com.doctcloud.hisinfo.ordadm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.doctcloud.common.core.utils.StringUtils;
import com.doctcloud.hisinfo.histable.domain.ordadm.OrdersCostsDo;
import com.doctcloud.hisinfo.ordadm.mapper.OrdersCostsMapper;
import com.doctcloud.hisinfo.ordadm.service.IOrdersCostsService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.ArrayList;
import java.util.List;

@Service
public class OrdersCostsImpl extends ServiceImpl<OrdersCostsMapper, OrdersCostsDo> implements IOrdersCostsService {
    @Override
    public List<OrdersCostsDo> listPatAll(String patientId, Integer visitId) {
        List<OrdersCostsDo> resList = new ArrayList<>();
        if (StringUtils.isEmpty(patientId)) {
            log.error("参数patientId不得为空");
            System.out.println("参数patientId不得为空");
            return resList;
        }
        if (ObjectUtils.isEmpty(visitId)) {
            log.error("参数visitId不得为空");
            System.out.println("参数visitId不得为空");
            return resList;
        }
        LambdaQueryWrapper<OrdersCostsDo> query = Wrappers.lambdaQuery();
        query.eq(OrdersCostsDo::getPatientId,patientId)
                .eq(OrdersCostsDo::getVisitId,visitId);
        resList = baseMapper.selectList(query);
        return resList;
    }
}
